<template>
	<view>
		<u-sticky bgColor="#fff">
			<u-row>
				<u-col span="6" v-for="(item,index) in navtab">
					<view @click="cktab(item.id)" class="tab" :class="inck==item.id ?'tabck':''">
						{{item.name}}
					</view>
				</u-col>
			</u-row>
		</u-sticky>
		<view class="nullBox" v-if="list.length==0">
			<image src="../../static/null.png" mode="widthFix"></image>
			<view>暂无数据</view>
		</view>
		<view class="listBox">
			<view class="list" v-for="(item,index) in list">
				<view class="Ltop">
					<u-row>
						<u-col span="8">
							<view class="no">
								订单号{{item.orderNo}}
							</view>
						</u-col>
						<u-col span="4">
							<view class="stutic" :class="item.isPay?'s1':'s2'">
								{{item.isPay?'已付款':'未付款'}}
							</view>
						</u-col>
					</u-row>
				</view>
				<view class="Lcont">
					<u-row>
						<u-col span="3">
							门店
						</u-col>
						<u-col span="9">
							<view class="conts">
								{{item.storeName}}
							</view>
						</u-col>
					</u-row>
					<u-row>
						<u-col span="3">
							预约时间
						</u-col>
						<u-col span="9">
							<view class="conts">
								{{item.createTime | formatDate('-')}}
							</view>
						</u-col>
					</u-row>
					<u-row>
						<u-col span="3">
							预约地址
						</u-col>
						<u-col span="9">
							<view class="conts">{{item.storeAddress}}</view>
						</u-col>
					</u-row>
					<u-row>
						<u-col span="3">
							模型数量
						</u-col>
						<u-col span="9">
							<view class="conts">{{item.modelNum}}</view>
						</u-col>
					</u-row>
					<!-- 	<u-row>
						<u-col span="3">
							模型尺寸
						</u-col>
						<u-col span="9">
							<view class="conts">30CM</view>
						</u-col>
					</u-row> -->
					<u-row>
						<u-col span="3">
							付款方式
						</u-col>
						<u-col span="9">
							<view class="conts">{{item.payType?'线上付款':'线下付款'}}</view>
						</u-col>
					</u-row>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				inck: 0,
				pageNo: 1,
				navtab: [{
					id: 0,
					name: '未拍摄',
				}, {
					id: 1,
					name: '已完成'
				}],
				list: []
			}
		},
		filters: {
			// 时间戳处理
			formatDate: function(value, spe = '/') {
				// value = value * 1000
				let data = new Date(value);
				console.log('value', value)
				let year = data.getFullYear();
				let month = data.getMonth() + 1;
				let day = data.getDate();
				let h = data.getHours();
				let mm = data.getMinutes();
				let s = data.getSeconds();
				month = month > 10 ? month : "0" + month;
				day = day > 10 ? day : "0" + day;
				h = h > 10 ? h : "0" + h;
				mm = mm > 10 ? mm : "0" + mm;
				s = s > 10 ? s : "0" + s;
				return `${year}${spe}${month}${spe}${day} ${h}:${mm}:${s}`;
			}
		},

		onLoad() {
			this.API_Order();
		},
		onReachBottom() {
			this.API_Order();
		},
		methods: {
			cktab(id) {
				this.inck = id;
				this.list = [];
				this.pageNo = 1;
				this.API_Order();
			},
			API_Order() {
				var that = this;
				var pageNo = that.pageNo;
				that.ran
					.request('/app-api/system/user-model-order/page?pageNo=' + pageNo + '&pageSize=10&shootingStatus=' +
						that.inck, {}, 'GET')
					.then(res => {
						console.log(res);
						if (res.code == 200) {
							if (res.data.list == '') {

							} else {
								that.list = that.list.concat(res.data.list);
								that.pageNo = that.pageNo + 1;
							}
						} else {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							});
						}
					});
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #f8f8f8;
	}

	.listBox {
		.list {
			// padding: 0 20rpx;
			margin: 25rpx 25rpx 0;
			border-radius: 10rpx;
			background: #fff;
			overflow: hidden;

			.Lcont {
				padding: 0 20rpx;
				line-height: 60rpx;
				font-size: 26rpx;

				.title {}

				.conts {
					color: #666;
				}
			}

			.Ltop {
				background-image: linear-gradient(to bottom right, #e5e5e5, #f4f4f4);
				line-height: 60rpx;
				padding: 0 20rpx;

				.s1 {
					color: #302C29;
				}

				.s2 {
					color: #0055ff;
				}

				.stutic {
					font-size: 24rpx;
					text-align: right;
				}

				.no {
					font-size: 24rpx;
					font-weight: bold;
				}
			}
		}
	}

	.tab {
		text-align: center;
		line-height: 80rpx;
		border-bottom: 1rpx solid #eee;
	}

	.tabck {
		color: #302C29;
		font-weight: bold;
		// border-bottom: 4rpx solid #302C29 !important;
		position: relative;
	}

	.tabck::after {
		content: ''; // 必须
		position: absolute;
		left: -50rpx;
		margin-left: 50%;
		bottom: 0;
		right: 0;
		width: 100rpx;
		height: 4px;
		border-radius: 10rpx;
		background-color: #302C29;
	}
</style>